<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Edit Buildings</title>
</head>

<body>

<h1>UNO Course Scheduler - Edit Buildings</h1>

<?php

$building_id = $_GET['id'];

//initialize variables used to connect to database
$db = "scheduler";
$user = "root";
$pass = "";

//counting variable
$i = 0;

//connect to database
mysql_connect("localhost", $user, $pass);
@mysql_select_db($db);

//select statement
$query="SELECT * FROM buildings WHERE id='$building_id'";
$result=mysql_query($query);

//close
mysql_close();

$building_name=mysql_result($result,$i,"building_name");
$abbreviation=mysql_result($result,$i,"abbreviation");

echo '<p>';

echo '<form action="edit_do.php" method="get">';

//start table
echo "<table border='0'>";
	
	//create table row
	echo "<tr>";
		echo "<td><b>Building Name</b></td>";
		echo "<td>";
		echo "<input type='text' name='name' value='$building_name'>";
		echo "</td>";
	echo "</tr>";
	
	//create table row
	echo "<tr>";
		echo "<td><b>Abbreviation</b></td>";
		echo "<td>";
		echo "<input type='text' name='abbrev' value='$abbreviation'>";
		echo "</td>";
	echo "</tr>";

//end table tag
echo "</table>";

echo "<input type='hidden' name='id' value='$building_id'>";
echo '<input type="submit">';
echo '</form>';

echo '</p>';
	

?>

<p>
	<a href="index.php">&lt;&lt; Back to Buildings Portal</a><br />
</p>

</body>
</html>